package Views;
import java.util.Observable;
import java.util.Observer;

import javax.swing.JFrame;

import Draw.IDraw;
import Draw.Panel;

/**
 * Fenetre de visualisation des formes dessinees
 *
 */
public class VisualizationWindow extends JFrame implements Observer {
	private static final long serialVersionUID = 1L;
	private Panel panel;
	
	public  VisualizationWindow(){
		super();
		build();
	}
	
	@Override
	public void update(Observable o, Object arg) {
		panel.setMsg(true);
		panel.repaint();
	}
	
	/**
	 * Comportement de dessins (forme)
	 * @param drawBehavior
	 */
	public void addBehaviour(IDraw drawBehavior) {
		panel.setDrawBehavior(drawBehavior);
	}
	
	private void build() {
		setTitle("Visualization");
		setSize(600, 600);
		
		panel = new Panel();
		this.setContentPane(panel);
		
		setLocationRelativeTo(null);
		setResizable(false);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);		
	} 
}
